<script>
    $(function () {

        var form = new Vue({
            el:'#article',
            data:{
                submiting:false,
                step:1,
                amount:'',
                pay_method:window.default_pay_method,
                doReturn:false,
            },
            mounted:function(){
            },
            methods:{
                confirmAmount:function(event){
                    if (!confirmAmountForm_validator.form()){
                        return;
                    }

                    this.step = 3;
                },
                isSelected:function(event){
                    var that = event.target;

                    return $(that).parents('li:eq(0)').find('input:radio').attr('checked');
                },
                submit:function(event){
                    this.submiting = true;
                    $("#form").submit();
                },
            }
        });

        var confirmAmountForm_validator = $("#confirmAmountForm").validate({
            rules: {
                amount:{
                    required:true,
                    number:true,
                    min:window.assure_fund_minimum,
                },
            },
            messages: {
                amount:{
                    required:'请输入缴纳金额',
                },
            },
        });

        var validator = $("#form").validate({
            rules: {
                amount:{
                    required:true,
                    number:true,
                    min:window.assure_fund_minimum,
                },
                pay_method:{
                    required:true,
                },
                trade_type:{
                    required:true,
                },
            },
            messages: {
                amount:{
                    required:'请输入缴纳金额',
                },
                pay_method:{
                    required:'请选择支付方式',
                },
                trade_type:{
                    required:'缺少交易类型',
                },
            },
            submitHandler: function(form) {
                form.submit();
            },
        });
    });
</script>